/*
 * Copyright 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.fqdf.framework.android.view;

import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.View;

/**
 * A descendant of {@link SwipeRefreshLayout} which supports multiple
 * child views triggering a queryData gesture. You set the views which can trigger the gesture via
 * {@link #setSwipeableChildren(int...)}, providing it the child ids.
 */
public class TwoSwipeRefreshLayout extends MultiSwipeRefreshLayout {

    public TwoSwipeRefreshLayout(Context context) {
        super(context);
    }

    public TwoSwipeRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setSwipeableChildren(int originID, int noDataID) {
        super.setSwipeableChildren(originID, noDataID);
    }

    public void setSwipeableChildren(View originView, View noDataView) {
        super.setSwipeableChildren(originView, noDataView);
    }

    /**
     * 显示第一个数据view
     */
    public void showOriginData() {
        getChillren(0).setVisibility(View.VISIBLE);
        getChillren(1).setVisibility(View.GONE);
    }

    /**
     * 显示第二个数据view
     */
    public void showNoData() {
        getChillren(0).setVisibility(View.GONE);
        getChillren(1).setVisibility(View.VISIBLE);
    }

}
